5467 Return useful error message for DDI upload. #7107
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it: Makes the error message more useful when uploading an invalid DDI XML
Which issue(s) this PR closes: 5467
Closes #5467
Special notes for your reviewer: In Dataverses.java I removed the exception from the method signature and handled it in a try catch, where I return a useful message. In ImportDDIServiceBean I added a try catch with a specific error message for the
<codebook>
element. In ImportServiceBean I removed the message "XMLStreamException" which isn't useful.Suggestions on how to test this: Upload a pdf or invalid DDI XML and you will see a useful error message. If you upload a valid DDI XML starting from the
<codebook>
element, you will get a success message. If you upload a DDI XML where you remove the slashes from the identifier in the elements, you will get the invalid DOI error (make sure to do it for all occurrences of the identifier). I added the command and screenshots below. The success message is just to verify all is still working.COMMAND
SUCCESS
FAIL
BAD DOI
Does this PR introduce a user interface change? If mockups are available, please link/include them here: No
Is there a release notes update needed for this change?: It's not a big change so no
Additional documentation: